<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table id="proc"></table>
</body>
<script src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
    $(function () {
        init();
    })

    function withdraw(id){
        $.ajax({
            type: "GET",
            url: "/proc/withdraw",
            data: {"id":id},
            dateType: "json",
            success: function (res) {
                alert(res);
            }
        });
    }

    function init(){
        $.ajax({
            type:"GET",
            url:"/proc/list",
            data:{
            },
            dateType:"json",
            success:function (res) {
                $("#proc").empty();
                console.log(res)
                var i;
                for (i = 0; i < res.length; i++) {
                    var item = res[i];
                    var tr = $("<tr>");
                    var t1 = $("<td>");
                    var a = $("<a>")
                    a.attr("href","/proc/flowGraph.html?id="+item.id);
                    // a.attr("href","/proc/getPicById?id="+item.id);
                    a.append(item.id)
                    t1.append(a)
                    var t2 = $("<td>");
                    t2.append(item.startUserId);
                    var t3 =  $("<input>")
                    t3.attr("type","button")
                    t3.val("撤回");
                    t3.attr("onclick","withdraw("+item.id+")")
                    tr.append(t1);
                    tr.append(t2);
                    tr.append(t3);
                    $("#proc").append(tr);
                }
            }})
    }


</script>
</html>

